/**
 * @author 徐楠
 * @date 2022/1/23 11:27
 * @version 1.0
 */

package com.xunan.likou;

public class PalindromeNumber {
    public static void main(String[] args) {
        int x = 21112;
        boolean palindrome = isPalindrome(x);
        System.out.println(palindrome);
    }

    public static boolean isPalindrome(int x) {
        String str = String.valueOf(x);
        int charSum = str.length();
        for(int i=0,j=charSum-1;i<j;i++,j--) {
            if(str.charAt(i)!=str.charAt(j)) {
                return false;
            }
        }
        return true;
    }
}
